#include <vector>
using namespace std;
void backtrace(vector<int> &nums, vector<vector<int>> &res,
               vector<int> &selected, int cur) {
  res.push_back(selected);
  if (cur < nums.size()) {
    for (int i = cur; i < nums.size(); ++i) {
      selected.push_back(nums[i]);
      backtrace(nums, res, selected, i + 1);
      selected.pop_back();
    }
  }
}

vector<vector<int>> subsets(vector<int> &nums) {
  vector<vector<int>> res;
  vector<int> selected;
  backtrace(nums, res, selected, 0);
  return res;
}